package com.system.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.system.service.ISysOrgService;
import com.system.vo.SysOrgVO;


@Controller
@RequestMapping("/sys/orgMgr")
public class SysOrgController {

	@Autowired
	private ISysOrgService orgService;
	
	/**
	 * 查询机构列表
	 * @param 
	 * @return
	 * @throws Exception 
	 */
	@RequestMapping(value="queryAllOrg")
	@ResponseBody
	public String queryAllOrg() throws Exception{
		List<SysOrgVO> orgList= orgService.queryAllOrg();
		ObjectMapper mapper = new ObjectMapper();
		String orgJson = mapper.writeValueAsString(orgList);
		return orgJson;
	}

	@RequestMapping
	public String index(){
		return  "view-system/orgManage/orgManage";
	}
	
}
